package com.cloudweb.oa.service.impl;

import cn.js.fan.security.SecurityUtil;
import cn.js.fan.util.DateUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.cloudweb.oa.entity.User;
import com.cloudweb.oa.vo.Result;
import com.cloudwebsoft.framework.util.LogUtil;
import com.redmoon.oa.flow.WorkflowSequenceDb;
import com.redmoon.oa.visual.ModuleSetupDb;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.Iterator;
import java.util.Vector;

@RestController
@RequestMapping("/flow/macro")
public class FormMacroCtlController {

    @ApiOperation(value = "列出自动编号序列", notes = "列出自动编号序列", httpMethod = "POST")
    @ApiResponses({@ApiResponse(code = 200, message = "操作成功")})
    @ResponseBody
    @RequestMapping(value = "/listSequence", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8;"})
    public Result<Object> listSequence() {
        JSONArray ary = new JSONArray();
        WorkflowSequenceDb wsd = new WorkflowSequenceDb();
        for (Object o : wsd.list()) {
            wsd = (WorkflowSequenceDb) o;
            JSONObject json = new JSONObject();
            json.put("name", wsd.getName());
            json.put("value", String.valueOf(wsd.getId()));
            ary.add(json);
        }
        return new Result<>(ary);
    }

}
